#include <iostream>
#include <string>
using namespace std;
int Find_Pattern(string S,string P,int start_pos)
{
    //
    int last_pos = S.length()-P.length();
    // 匹配的最后一个位置
    int count = P.length();
    if(last_pos<start_pos)
        return -1;
    else
    {
        for(int g = start_pos;g<count;g++)
        {
            if(S.substr(start_pos,count) == P)
            {
                return g;
            }
        }
        return -1;
    }
}
int main() {
    string a = "aabbccabcccb";
    string b = "abc";
    int n = Find_Pattern(a,b,0);
    if(n != -1)
    {
        cout<<"n = "<<n<<"\n";
        cout<<"匹配到字符串"<<endl;
        cout<<"字符串为:"<<a.substr(n,3);
    }
    return 0;
}